#ifndef CLIPBOARDMANAGER_H
#define CLIPBOARDMANAGER_H

#include <QObject>
#include <QClipboard>
#include <QDebug>
#include <QMap>

class ClipboardManager : public QObject
{
    Q_OBJECT
public:
    explicit ClipboardManager(QObject *parent = nullptr);
    ~ClipboardManager() { delete m_pbinbuf; delete m_ptextbuf; }
    QByteArray data() const;

private:
    void clear();
    QClipboard* m_pclipboard;
    QByteArray* m_pbinbuf; // out bin
    QByteArray* m_ptextbuf; // in base64
    QString m_fileName;

    qint64 m_lastBufferChanging = 0;

    QString m_myHardwareId;

signals:
    void readyToSave(QString name);
    void preparedToTransfer(QString name);
    void rawBufferChanged(QString name);
    void tooBigSize(QString string);
    void clearFields();

public slots:
    void handleClipboard();
    void prepareToTransfer();
};

#endif // CLIPBOARDMANAGER_H
